﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using GrapeCity.PAutoTester.Core;

namespace ServerControler
{
    public class Case
    {
        public static string GetCaseList(string assemblyPath)
        {
            if (string.IsNullOrEmpty(assemblyPath))
            {
                throw new ArgumentNullException("Please set assembly path.");
            }

            TestAssembly testAssembly = new TestAssembly(assemblyPath);
            StringBuilder sb = new StringBuilder();
            sb.Append("Assembly!" + testAssembly.FullName);
            sb.Append(";");
            foreach (TestClass testClass in testAssembly.TestClasses)
            {
                sb.Append("Class!" + testClass.FullName);
                sb.Append(";");
                foreach (TestMethod method in testClass.TestMethods)
                {
                    sb.Append("Method!" + method.FullName);
                    sb.Append(";");
                }
            }

            return sb.ToString();
        }
    }
}
